<template>
    <el-table :data="data" style="width: 100%">
        <el-table-column prop="toDoTitle" label="待办事项" />
        <el-table-column prop="toDoTime" label="待办时间" />
        <el-table-column prop="author" label="发起人" />
        <el-table-column prop="state" label="状态" />
    </el-table>
</template>
<script lang="ts" setup>
import { useToDoStore } from '@/store/userState';
import { storeToRefs } from 'pinia';
import { computed } from 'vue';

const todoStore = useToDoStore()
const { toDoList } = storeToRefs(todoStore)

const { isHome } = defineProps({
    isHome: {
        type: Boolean,
        default: false
    }
})

const data = computed(() => {
    return isHome ? toDoList.value.slice(0, 5) : toDoList.value
})


</script>